PATHCONF
Section: Misc. Reference Manual Pages (2P)
Updated: August 1, 1992
Index
Return to Main Contents
NAME
pathconf, fpathconf - (POSIX only) get configurable pathname variables
SYNOPSIS
#include <unistd.h>
long pathconf(const char *path, int name);
long fpathconf(int fildes, int name);
DESCRIPTION
The information in this specification applies
only to POSIX applications.
The
pathconf
and
fpathconf
functions allow an application to query the current value of a
configurable limit or option (variable) associated with a file or directory.
The
pathconf
function takes the name of a file or directory whose pathname is pointed to
by the path argument.
The
fpathconf
function, on the other hand, takes an open file descriptor as given by the
fildes argument.
The name argument represents the variable to be determined relative
to the file.
The variables that may be queried by
pathconf
or
fpathconf
and the corresponding values for the name argument are listed below:
-
- Variable
-
name Value Notes
- {LINK_MAX}
-
{_PC_LINK_MAX} (1)
- {MAX_CANON}
-
{_PC_MAX_CANON} (2)
- {MAX_INPUT}
-
{_PC_MAX_INPUT} (2)
- {NAME_MAX}
-
{_PC_NAME_MAX} (3)
- {PATH_MAX}
-
{_PC_PATH_MAX} (4)
- {PIPE_BUF}
-
{_PC_PIPE_BUF} (5)
- {_POSIX_CHOWN_RESTRICTED}
-
{_PC_CHOWN_RESTRICTED} (6)
- {_POSIX_NO_TRUNC}
-
{_PC_NO_TRUNC} (3)
- {_POSIX_VDISABLE}
-
{_PC_VDISABLE} (2)
-
NOTES:
-
- (1)
-
If path or fildes refers to a directory, the value returned
applies to the directory itself.
- (2)
-
The value returned only applies to terminal files.
- (3)
-
If path or fildes refers to a directory, the value returned
applies to the filenames within the directory.
- (4)
-
If path or fildes refers to a directory, the value returned
is the maximum length of a relative pathname when the specified directory
is the current working directory.
- (5)
-
If path refers to a FIFO, or fildes refers to a pipe or a FIFO,
then the value returned applies to the referenced object itself.
If path or fildes refers to a directory, then the value returned
applies to any FIFOs that exist or can be created within the specified
directory.
- (6)
-
If path or fildes refers to a directory, then the value returned
applies to terminal files that exist or can be created within the specified
directory.
The meaning of each variable is as follows:
-
- Variable
-
Description
- {LINK_MAX}
-
Maximum value of a file's link count.
- {MAX_CANON}
-
Maximum number of bytes in a terminal canonical input line.
- {MAX_INPUT}
-
Minimum number of bytes for which space will be available
in a terminal input queue; therefore, the maximum number of bytes a
portable application may require to be typed as input before reading them.
- {NAME_MAX}
-
Maximum number of bytes in a file name, excluding the terminating null.
- {PATH_MAX}
-
Maximum number of bytes in a pathname, excluding the terminating null.
- {PIPE_BUF}
-
Maximum number of bytes that can written atomically when writing
to a pipe or FIFO.
- {_POSIX_CHOWN_RESTRICTED}
-
The use of
chown
is restricted to super-user, and
to changing the group ID of a file only to the effective group ID
of the process or to one of its supplementary group IDs.
- {_POSIX_NO_TRUNC}
-
Pathname components longer that {NAME_MAX} generate an error.
- {_POSIX_VDISABLE}
-
Terminal special characters can be disabled using
this character value, if it is defined. See
tcgetattr(2P)
and
tcsetattr(2P).
The values for the variables above are given in the header <limits.h>.
The symbolic constants used as values for name are given in
<unistd.h>.
RETURN VALUE
Upon successful completion, both
pathconf
and
fpathconf
return the current variable value for the file or directory without
changing errno.
If the variable corresponding to name has no limit for the file
or directory, then
pathconf
and
fpathconf
return -1 without changing errno.
Otherwise, if an error condition occurs, then both functions return -1 and
change the value of errno to indicate the error.
ERRORS
If any of the following conditions occur, the
pathconf
and
fpathconf
functions return -1 and set errno to the corresponding value:
- [EINVAL]
-
The value of name is invalid.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUE
-
- ERRORS
-
This document was created by
man2html,
using the manual pages.
Time: 17:22:35 GMT, March 25, 2025